package com.mg.smarttask.server;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class NoteDO {
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key id;
	@Persistent
	private Text description;
	@Persistent
	private String title;
	@Persistent
	private Boolean isShared;
	@Persistent
	private Boolean isDone ;
	@Persistent
	private Date creationDate;
	@Persistent
	private Date modificationDate;
	@Persistent
	private long ownerId;
	
	NoteDO(){
		this.isDone = false;
		this.isShared = false;
		this.ownerId = 1;
	}
	
	public NoteDO(String title,Text description, Boolean isShared, Boolean isDone,
			Date creationDate,Date modificationDate){
		this.title = title;
		this.description = description;
		this.isDone = isDone;
		this.isShared = isShared;
		this.creationDate = creationDate;
		this.modificationDate = modificationDate;
		this.ownerId = 1;
	}
	
	
	//getters and Setters
	public String getDescription(){
		return description.getValue();
	}
	public String getTitle(){
		return title;
	}
	public boolean getIsShared(){
		return isShared;
	}
	public boolean getIsDone(){
		return isDone;
	}
	public void setDescription(Text description){
		this.description = description;
	}
	public void setTitle(String title){
		this.title = title;
	}
	public void setIsShared(boolean isShared){
		this.isShared = isShared;
	}
	public void setIsDone(boolean isDone){
		this.isDone = isDone;
	}
	public void setCreationDate(Date creationDate){
		this.creationDate = creationDate;
	}
	public Date getCreationDate(){
		return creationDate;
	}
	public Date getModificationDate(){
		return modificationDate;
	}
	public void setModificationDate(Date modificationDate){
		this.modificationDate = modificationDate;
	}
	public long getOwnerId(){
		return ownerId;
	}
	public void setOwnerId(long ownerId){
		this.ownerId = ownerId;
	}
	public long getId(){
		return id.getId();
	}
	public void setKey(Key id){
		this.id = id;
	}
}
